<template>
    <div class="jd-user">
        <Tabbar/>
        <Navbabbar title="个人中心"/>
        <div v-text="title"></div>
        <button @click="outON">退出</button>
    </div>
</template>
<script>
import { Tabbar, Navbabbar} from '@/components/index';
export default {
    beforeRouteEnter(to,from,next){
        localStorage.getItem("token")?next():next('/logion')
  },
        name:"User",

    components:{ 
        Tabbar,
        Navbabbar
    },
    data(){
        return{
        }
    },
    computed:{
       title(){
           const name = localStorage.getItem('token')
          return  name
        }
    },
    methods:{
        outON(){
            localStorage.removeItem('token')
            // Toast('退出成功')
            this.$router.push('/logion')

        }
    }
       
    
    
}
</script>
<style lang="scss" scoped>
.jd-user{
    padding-top: 2rem;
    text-align: center;
}

</style>